<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-row :gutter="32" style="background:#fff;">
      <el-col :xs="32" :sm="32" :lg="32" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description" style="display: inline; line-height: 60px;">
            <div class="card-panel-text" style="display: inline">
              工单数据分析
            </div>
            <count-to :start-val="0" :end-val="0" :duration="2600" class="card-panel-num" />
            <div style="display: inline; float: right; margin-left: 10px">
              <el-button type="primary" @click="clickThrity()">近30日</el-button>
            </div>
            <div style="display: inline; float: right;">
              <el-button type="primary" @click="clickSeven()">近7日</el-button>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="32" style="background:#4f4949;">
      <el-col :xs="12" :sm="12" :lg="5" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-description">
            <div class="card-panel-text" style="height: 1px">
            </div>
            <count-to :start-val="0" :end-val="0" :duration="2600" class="card-panel-num" />
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="32" style="background:#fff;padding:16px 0 0;margin-bottom:32px;">
      <el-col :xs="32" :sm="32" :lg="18">
        <line-chart :chart-data="lineChartData"/>
      </el-col>
      <el-col :xs="32" :sm="32" :lg="6">
        <div class="chart-wrapper">
          <order-list :order-rank="lineChartData"/>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import OrderList from './dashboard/list'

export default {
  name: 'Index',
  num: 7,
  components: {
    PanelGroup,
    LineChart,
    OrderList
  },
  data() {
    return {
      lineChartData: 7
    }
  },
  methods: {
    clickSeven() {
      this.lineChartData = 7
    },
    clickThrity() {
      this.lineChartData = 30
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
